package com.rayboo.example.design.pattern.strategy;

/**
 * 策略模式
 * http://c.biancheng.net/view/1378.html
 */
public class Main {

    public static void main(String[] args) {
        Context context = new Context(8, 5);
        System.out.println("加：" + context.execute());

        context.setStrategy(new SubtractionStrategy());
        System.out.println("减：" + context.execute());

        context.setStrategy(new MultiplyStrategy());
        System.out.println("乘：" + context.execute());

        context.setStrategy(new DivisionStrategy());
        System.out.println("除：" + context.execute());

        context.setStrategy(new RemainStrategy());
        System.out.println("余：" + context.execute());
    }
}
